#ifndef RESIZERECT_H
#define RESIZERECT_H

#include <QObject>
#include <QGraphicsItem>
#include <QGraphicsWidget>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include <QRectF>
#include <QGraphicsSceneHoverEvent>
#include <QWidget>
#include <QDebug>

class VisBaseWidget;

//Note on resizing:
//principle:  resizeRect would be drawn when user hovers over it
//on click and drag in resize rect, resize() function would be called on
//parent visbasewidget
//problem:  child widgets not auto-resize as expected.  Not sure if it is
//because I implemented boundingRect in child widgets with fixed variables width and height


class ResizeRect : public QGraphicsWidget
{
    Q_OBJECT

public:
    explicit ResizeRect(VisBaseWidget *parent = 0);
    
    QRectF boundingRect() const;
    QPainterPath shape() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
               QWidget *widget);

signals:

public slots:
    void hoverEnterEvent(QGraphicsSceneHoverEvent *event);//if hovered over, draw rect
    void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);

private:
    bool hovering;
    bool mousePressed;

    VisBaseWidget* parent;

};

#endif // RESIZERECT_H
